package org.example.node;

/**
 * @author liyishan
 * @date 2024/3/22 11:03
 * @apiNote
 */

public class Test00206ReverseList {

    public ListNode reverseList(ListNode head) {
        ListNode prev = null;
        ListNode curr = head;
        while (curr != null) {
            ListNode next = curr.next;
            curr.next = prev;
            prev = curr;
            curr = next;
        }
        return prev;
    }
}
